package com.eorchis.module.trainingclass.domain;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Date;

import com.eorchis.utils.DateUtil;
import com.eorchis.utils.utils.PropertyUtil;

/**
 * Title: TrainingClass<br>
 * Description: 培训班信息实体对象<br>
 * Company: GoldGov<br>
 * Copyright @ 2012 GoldGov .All rights reserved.<br>
 * @author Max
 * @createDate 2013-12-10
 * @version $Revision$
 */

public class TrainingClassQueryBean {

	private String classId;//培训班ID
	private String className;//培训班名称
	private String classnameYear;//培训班名称--年度
	private String classnamePeriodType;//期数 名称
	private Integer classnamePeriod;//培训班名称--期数
	private String classnameUnit;//培训班名称--单位
	private Integer classnameUnitid;//培训班名称--单位ID
	private String classType;//培训班类型
	private String trainingType;//培训类别
	private Integer classUserNum;//班级人数
	private String timeUnit;//培训时间单位
	private Double trainingHour;//培训课时
	private Double trainingDay;//培训天数
	private Date beginDate;//开班时间
	private Date endDate;//结班时间
	private String beginDateNoTime;//开班时间 无时分秒
	private String endDateNoTime;//结班时间 无时分秒
	private String trainingOrganization;//培训机构
	private String trainingOrganizationName;//培训机构名称
	private Date enterBeginTime;//报名开始时间
	private Date enterEndTime;//报名结束时间
	private String applyWay;//报名方式
	private String setApplyOrgan;//报机构设置
	private String beoffCode;//离岗状态
	private Integer organizerId;//主办单位ID
	private String organizerName;//主办单位名称
	private Integer undertakeUnitId;//合办单位
	private String undertakeUnitName;//合办单位名称
	private String trainingAddress;//培训地点
	private String classDescription;//培训内容
	private String applyLevelName;//培训职级
	private Integer publishState;//发布状态
	private Integer openState;//开班状态
	private Integer endState;//结班状态 
	private Integer activeState;//活动状态
	private Date latestOperateDate;//最后操作时间
	private String classCategory;//班级类型
	
	private String applyOrganCode;//报名机构设置对应的数据字典中的code
	
	private Long reportedNum;//已报人数 (通过审核)
	private Long reportedNumber;//已报人数 (已选的人数)
	
	private Integer reportState;//上报状态
	private Date reportDate;//上报时间
	private String reportDepId;//上报单位ID
	private String reportDepName;//上报单位名称
	private Integer auditState;//班级项目审核状态
	private Date auditingDate;//项目审批时间
	
	private Long classStuNum=0L;//人员审核通过数量
	private Long auditNoPass=0L;//人员审核未通过的数据量
	private Long noAudit=0L;//人员未审核的数据量
	
	private Integer stuAuditState=0;//学员审核状态 
	private Integer auditStuNum=0;//还需要操作学员的数量
	
	private Double trainingHourBig;
	private Double trainingDayBig;
	private BigInteger classUserNumBig;
	private BigInteger reportedNumBig;
	private BigInteger openStateBig;
	private BigInteger endStateBig;
	private BigInteger publishStateBig;
	private BigInteger activeStateBig;
	private BigInteger reportStateBig;
	private BigInteger auditStateBig;
	private BigInteger classStuNumBig;
	private BigInteger auditNoPassBig;
	private BigInteger noAuditBig;
	private BigInteger noAuditHoursBig;
	private Long noAuditHours=0L;

	
	private String deptName;//报名单位名称
	private Long restrictPersonNum=0L;//限制人数
	private String deptID;//单位id
	private Date createDate;//创建时间
	
	private Double tempHour;//临时保存学时
	
	private Integer isDeptTrainingClass;//判断培训班是否是当前单位创建，1：是    2:否
	private String organizerIdStr;//主办单位ID字符串
	
	private Integer ROWNUM_;
	public void setROWNUM_(Integer rOWNUM_) {
		ROWNUM_ = rOWNUM_;
	}
	
	public String getReportDepId() {
		return reportDepId;
	}
	public void setReportDepId(String reportDepId) {
		this.reportDepId = reportDepId;
	}
	public String getReportDepName() {
		return reportDepName;
	}
	public void setReportDepName(String reportDepName) {
		this.reportDepName = reportDepName;
	}
	public String getOrganizerIdStr() {
		return organizerIdStr;
	}
	public void setOrganizerIdStr(String organizerIdStr) {
		this.organizerIdStr = organizerIdStr;
	}
	public Integer getIsDeptTrainingClass() {
		return isDeptTrainingClass;
	}
	public void setIsDeptTrainingClass(Integer isDeptTrainingClass) {
		this.isDeptTrainingClass = isDeptTrainingClass;
	}
	public Double getTempHour() {
		return tempHour;
	}
	public void setTempHour(Double tempHour) {
		this.tempHour = tempHour;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public Date getReportDate() {
		return reportDate;
	}
	public void setReportDate(Date reportDate) {
		this.reportDate = reportDate;
	}
	public String getDeptID() {
		return deptID;
	}
	public void setDeptID(String deptID) {
		this.deptID = deptID;
	}
	public Long getRestrictPersonNum() {
		return restrictPersonNum;
	}
	public void setRestrictPersonNum(Long restrictPersonNum) {
		this.restrictPersonNum = restrictPersonNum;
	}
	public String getDeptName() {
		return deptName;
	}
	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}
	public String getClassId() {
		return classId;
	}
	public void setClassId(String classId) {
		this.classId = classId;
	}
	public String getClassName() {
//		Integer qi=0;
//		if(!classnamePeriodType.equals("006")) {
//			if(classnamePeriodType.equals("005")) {
//				return classnameYear+"年"+classnameUnit+className;
//			}
//			qi=Integer.parseInt(classnamePeriodType);
//		}else {
//			qi=classnamePeriod;
//		}
//		return classnameYear+"年"+classnameUnit+"第"+qi+"期"+className;
		return className;
	}
	public void setClassName(String className) {
		this.className = className;
	}
	public String getClassnameYear() {
		return classnameYear;
	}
	public void setClassnameYear(String classnameYear) {
		this.classnameYear = classnameYear;
	}
	public Integer getClassnamePeriod() {
		return classnamePeriod;
	}
	public void setClassnamePeriod(Integer classnamePeriod) {
		this.classnamePeriod = classnamePeriod;
	}
	public String getClassnameUnit() {
		return classnameUnit;
	}
	public void setClassnameUnit(String classnameUnit) {
		this.classnameUnit = classnameUnit;
	}
	public Integer getClassnameUnitid() {
		return classnameUnitid;
	}
	public void setClassnameUnitid(Integer classnameUnitid) {
		this.classnameUnitid = classnameUnitid;
	}
	public String getClassType() {
		return classType;
	}
	public void setClassType(String classType) {
		this.classType = classType;
	}
	public String getTrainingType() {
		return trainingType;
	}
	public void setTrainingType(String trainingType) {
		this.trainingType = trainingType;
	}
	public Integer getClassUserNum() {
		return classUserNum;
	}
	public void setClassUserNum(Integer classUserNum) {
		this.classUserNum = classUserNum;
	}
	public String getTimeUnit() {
		return timeUnit;
	}
	public void setTimeUnit(String timeUnit) {
		this.timeUnit = timeUnit;
	}
	public Double getTrainingHour() {
		DecimalFormat   df   =   new   DecimalFormat("#####0");  
		df.setGroupingSize(0);
		df.setRoundingMode(RoundingMode.FLOOR);
		if(PropertyUtil.objectNotEmpty(trainingHour)) {
			if(trainingHour%8==0) {
				return trainingHour/8;
			}else {
				return Double.parseDouble(df.format(trainingHour/8+1));
			}
		}
		return trainingHour;
	}
	public void setTrainingHour(Double trainingHour) {
		this.tempHour = trainingHour;
		this.trainingHour = trainingHour;
	}
	public Double getTrainingDay() {
		return trainingDay;
	}
	public void setTrainingDay(Double trainingDay) {
		this.trainingDay = trainingDay;
	}
	public String getBeginDate() {
		return DateUtil.getDateString(beginDate, "yyyy-MM-dd");
		//return beginDate;
	}
	public void setBeginDate(Date beginDate) {
		this.beginDate = beginDate;
	}
	public String getBeginDateNoTime() {
		return DateUtil.getDateString(beginDate, "yyyy-MM-dd");
		//return beginDate;
	}
	public String getEndDate() {
		return DateUtil.getDateString(endDate, "yyyy-MM-dd");
		//return endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	public String getEndDateNoTime() {
		return DateUtil.getDateString(endDate, "yyyy-MM-dd");
		//return endDate;
	}
	public String getTrainingOrganization() {
		return trainingOrganization;
	}
	public void setTrainingOrganization(String trainingOrganization) {
		this.trainingOrganization = trainingOrganization;
	}
	public String getTrainingOrganizationName() {
		return trainingOrganizationName;
	}
	public void setTrainingOrganizationName(String trainingOrganizationName) {
		this.trainingOrganizationName = trainingOrganizationName;
	}
	public String getEnterBeginTime() {
		return DateUtil.getDateString(enterBeginTime, "yyyy-MM-dd");
	}
	public void setEnterBeginTime(Date enterBeginTime) {
		this.enterBeginTime = enterBeginTime;
	}
	public String getEnterEndTime() {
		return DateUtil.getDateString(enterEndTime, "yyyy-MM-dd");
	}
	public void setEnterEndTime(Date enterEndTime) {
		this.enterEndTime = enterEndTime;
	}
	public String getApplyWay() {
		return applyWay;
	}
	public void setApplyWay(String applyWay) {
		this.applyWay = applyWay;
	}
	public String getSetApplyOrgan() {
		return setApplyOrgan;
	}
	public void setSetApplyOrgan(String setApplyOrgan) {
		this.setApplyOrgan = setApplyOrgan;
	}
	public String getBeoffCode() {
		return beoffCode;
	}
	public void setBeoffCode(String beoffCode) {
		this.beoffCode = beoffCode;
	}
	public Integer getOrganizerId() {
		return organizerId;
	}
	public void setOrganizerId(Integer organizerId) {
		this.organizerId = organizerId;
	}
	public String getOrganizerName() {
		return organizerName;
	}
	public void setOrganizerName(String organizerName) {
		this.organizerName = organizerName;
	}
	public Integer getUndertakeUnitId() {
		return undertakeUnitId;
	}
	public void setUndertakeUnitId(Integer undertakeUnitId) {
		this.undertakeUnitId = undertakeUnitId;
	}
	public String getUndertakeUnitName() {
		return undertakeUnitName;
	}
	public void setUndertakeUnitName(String undertakeUnitName) {
		this.undertakeUnitName = undertakeUnitName;
	}
	public String getTrainingAddress() {
		return trainingAddress;
	}
	public void setTrainingAddress(String trainingAddress) {
		this.trainingAddress = trainingAddress;
	}
	public String getClassDescription() {
		return classDescription;
	}
	public void setClassDescription(String classDescription) {
		this.classDescription = classDescription;
	}
	public String getApplyLevelName() {
		return applyLevelName;
	}
	public void setApplyLevelName(String applyLevelName) {
		this.applyLevelName = applyLevelName;
	}
	public Integer getPublishState() {
		return publishState;
	}
	public void setPublishState(Integer publishState) {
		this.publishState = publishState;
	}
	public Integer getOpenState() {
		return openState;
	}
	public void setOpenState(Integer openState) {
		this.openState = openState;
	}
	public Integer getEndState() {
		return endState;
	}
	public void setEndState(Integer endState) {
		this.endState = endState;
	}
	public Integer getActiveState() {
		return activeState;
	}
	public void setActiveState(Integer activeState) {
		this.activeState = activeState;
	}
	public Date getLatestOperateDate() {
		return latestOperateDate;
	}
	public void setLatestOperateDate(Date latestOperateDate) {
		this.latestOperateDate = latestOperateDate;
	}
	public Long getReportedNum() {
		return reportedNum;
	}
	public void setReportedNum(Long reportedNum) {
		this.reportedNum = reportedNum;
	}
	public Long getReportedNumber() {
		return reportedNumber;
	}
	public void setReportedNumber(Long reportedNumber) {
		this.reportedNumber = reportedNumber;
	}
	public String getApplyOrganCode() {
		return applyOrganCode;
	}
	public void setApplyOrganCode(String applyOrganCode) {
		this.applyOrganCode = applyOrganCode;
	}
	public String getClassnamePeriodType() {
		return classnamePeriodType;
	}
	public void setClassnamePeriodType(String classnamePeriodType) {
		this.classnamePeriodType = classnamePeriodType;
	}
	public Integer getReportState() {
		return reportState;
	}
	public void setReportState(Integer reportState) {
		this.reportState = reportState;
	}
	public Integer getAuditState() {
		return auditState;
	}
	public void setAuditState(Integer auditState) {
		this.auditState = auditState;
	}
	
	public Long getClassStuNum() {
		return classStuNum;
	}
	public void setClassStuNum(Long classStuNum) {
		this.classStuNum = classStuNum;
	}
	public Long getAuditNoPass() {
		return auditNoPass;
	}
	public void setAuditNoPass(Long auditNoPass) {
		this.auditNoPass = auditNoPass;
	}
	public Long getNoAudit() {
		return noAudit;
	}
	public void setNoAudit(Long noAudit) {
		this.noAudit = noAudit;
	}
	
	public Integer getStuAuditState() {
		//在get方法里面进行逻辑判断
		//classStuNum;//总人数
		//reportedNum;//审核通过的人数
		//auditNoPass;//审核未通过的人数
		//noAudit;//未审核的人数
		
//		1：审核通过
//		2：未审核
//		3：审核未通过
//		4：审核中
		if(classStuNum>0) {
			if(classStuNum==Integer.parseInt(Long.toString(reportedNum))) {
				//审核通过
				stuAuditState=1;
			}
			
			if(noAudit>0) {
				if(classStuNum==Integer.parseInt(Long.toString(noAudit))) {
					//未审核
					stuAuditState=2;
				}else {
					//审核中
					stuAuditState=4;
				}
			}
			
			if(auditNoPass>0) {
				if(classStuNum==reportedNum+auditNoPass) {
					//审核未通过
					stuAuditState=3;
					auditStuNum=Integer.parseInt(Long.toString(auditNoPass));//显示人数
				}
			}
		}else {
			//当班里面人数为空时
			//未审核
			stuAuditState=2;
		}
		
		return stuAuditState;
	}
	public void setStuAuditState(Integer stuAuditState) {
		this.stuAuditState = stuAuditState;
	}
	public Integer getAuditStuNum() {
		return auditStuNum;
	}
	public void setAuditStuNum(Integer auditStuNum) {
		this.auditStuNum = auditStuNum;
	}
	public Double getTrainingHourBig() {
		return trainingHourBig;
	}
	
	public void setTrainingHourBig(Double trainingHourBig) {
		if(trainingHourBig!=null) {
			setTrainingHour(trainingHourBig);
		}
		this.trainingHourBig = trainingHourBig;
	}
	public Double getTrainingDayBig() {
		return trainingDayBig;
	}
	public void setTrainingDayBig(Double trainingDayBig) {
		if(trainingDayBig!=null) {
			setTrainingDay(trainingDayBig);
		}
		this.trainingDayBig = trainingDayBig;
	}
	public BigInteger getClassUserNumBig() {
		return classUserNumBig;
	}
	public void setClassUserNumBig(BigInteger classUserNumBig) {
		if(classUserNumBig!=null) {
			setClassUserNum(Integer.parseInt(classUserNumBig.toString()));
		}
		this.classUserNumBig = classUserNumBig;
	}
	public BigInteger getReportedNumBig() {
		return reportedNumBig;
	}
	public void setReportedNumBig(BigInteger reportedNumBig) {
		if(reportedNumBig!=null) {
			setReportedNum(Long.parseLong(reportedNumBig.toString()));
		}
		this.reportedNumBig = reportedNumBig;
	}
	public BigInteger getOpenStateBig() {
		return openStateBig;
	}
	public void setOpenStateBig(BigInteger openStateBig) {
		if(openStateBig!=null) {
			setOpenState(Integer.parseInt(openStateBig.toString()));
		}
		this.openStateBig = openStateBig;
	}
	public BigInteger getEndStateBig() {
		return endStateBig;
	}
	public void setEndStateBig(BigInteger endStateBig) {
		if(endStateBig!=null) {
			setEndState(Integer.parseInt(endStateBig.toString()));
		}
		this.endStateBig = endStateBig;
	}
	public BigInteger getPublishStateBig() {
		return publishStateBig;
	}
	public void setPublishStateBig(BigInteger publishStateBig) {
		if(publishStateBig!=null) {
			setPublishState(Integer.parseInt(publishStateBig.toString()));
		}
		this.publishStateBig = publishStateBig;
	}
	public BigInteger getActiveStateBig() {
		return activeStateBig;
	}
	public void setActiveStateBig(BigInteger activeStateBig) {
		if(activeStateBig!=null) {
			setActiveState(Integer.parseInt(activeStateBig.toString()));
		}
		this.activeStateBig = activeStateBig;
	}
	public BigInteger getReportStateBig() {
		return reportStateBig;
	}
	public void setReportStateBig(BigInteger reportStateBig) {
		if(reportStateBig!=null) {
			setReportState(Integer.parseInt(reportStateBig.toString()));
		}
		this.reportStateBig = reportStateBig;
	}
	public BigInteger getAuditStateBig() {
		return auditStateBig;
	}
	public void setAuditStateBig(BigInteger auditStateBig) {
		if(auditStateBig!=null) {
			setAuditState(Integer.parseInt(auditStateBig.toString()));
		}
		this.auditStateBig = auditStateBig;
	}
	public BigInteger getClassStuNumBig() {
		return classStuNumBig;
	}
	public void setClassStuNumBig(BigInteger classStuNumBig) {
		if(classStuNumBig!=null) {
			setClassStuNum(Long.parseLong(classStuNumBig.toString()));
		}
		this.classStuNumBig = classStuNumBig;
	}
	public BigInteger getAuditNoPassBig() {
		return auditNoPassBig;
	}
	public void setAuditNoPassBig(BigInteger auditNoPassBig) {
		if(auditNoPassBig!=null) {
			setAuditNoPass(Long.parseLong(auditNoPassBig.toString()));
		}
		this.auditNoPassBig = auditNoPassBig;
	}
	public BigInteger getNoAuditBig() {
		return noAuditBig;
	}
	public void setNoAuditBig(BigInteger noAuditBig) {
		if(noAuditBig!=null) {
			 setNoAudit(Long.parseLong(noAuditBig.toString()));
		}
		this.noAuditBig = noAuditBig;
	}
	public String getClassCategory() {
		return classCategory;
	}
	public void setClassCategory(String classCategory) {
		this.classCategory = classCategory;
	}
	
	
	
	public BigInteger getNoAuditHoursBig() {
		return noAuditHoursBig;
	}
	public void setNoAuditHoursBig(BigInteger noAuditHoursBig) {
		if(noAuditHoursBig!=null) {
			this.setNoAuditHours(Long.parseLong(noAuditHoursBig.toString()));
		}
		this.noAuditHoursBig = noAuditHoursBig;
	}
	public Long getNoAuditHours() {
		return noAuditHours;
	}
	public void setNoAuditHours(Long noAuditHours) {
		this.noAuditHours = noAuditHours;
	}
	
	public String getAuditingDate() { 
			return DateUtil.getDateString(auditingDate, "yyyy-MM-dd HH:mm");
	}
	public void setAuditingDate(Date auditingDate) {
		this.auditingDate = auditingDate;
	}
	public static void main(String [] args) {
		Double trainingHour=20.7;
		BigDecimal b=new BigDecimal(2.1);
		System.out.println(b);
		DecimalFormat   df   =   new   DecimalFormat("#####0"); 
		df.setGroupingSize(0);
		df.setRoundingMode(RoundingMode.FLOOR);
		if(PropertyUtil.objectNotEmpty(trainingHour)) {
			if(trainingHour%8==0) {
				System.out.println (trainingHour/8);
			}else {
				System.out.println (trainingHour/8+1);
				System.out.println (Double.parseDouble(df.format(trainingHour/8+1)));
			}
		}
	}
}
